home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / fssharea / frmserve.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-09-19  |  3.3 KB  |  98 lines

  1. VERSION 5.00
  2. Begin VB.Form frmServer 
  3.    Caption         =   "Server"
  4.    ClientHeight    =   2190
  5.    ClientLeft      =   60
  6.    ClientTop       =   345
  7.    ClientWidth     =   4830
  8.    LinkTopic       =   "Form1"
  9.    ScaleHeight     =   2190
  10.    ScaleWidth      =   4830
  11.    StartUpPosition =   3  'Windows Default
  12.    Begin VB.CommandButton cmdClient 
  13.       Caption         =   "&Client"
  14.       Height          =   465
  15.       Left            =   210
  16.       TabIndex        =   2
  17.       Top             =   150
  18.       Width           =   2910
  19.    End
  20.    Begin VB.CommandButton cmdOK 
  21.       Caption         =   "OK"
  22.       Height          =   465
  23.       Left            =   3450
  24.       TabIndex        =   0
  25.       Top             =   150
  26.       Width           =   1200
  27.    End
  28.    Begin VB.Label Label1 
  29.       BorderStyle     =   1  'Fixed Single
  30.       Height          =   1335
  31.       Left            =   210
  32.       TabIndex        =   1
  33.       Top             =   690
  34.       Width           =   2895
  35.    End
  36. Attribute VB_Name = "frmServer"
  37. Attribute VB_GlobalNameSpace = False
  38. Attribute VB_Creatable = False
  39. Attribute VB_PredeclaredId = True
  40. Attribute VB_Exposed = False
  41. ' *******************************************************************
  42. ' ** This example was created by Fishhead Software, 1998
  43. ' *******************************************************************
  44. Option Explicit
  45. Private m_Share As fsShare
  46. Private m_Handle As Long
  47. Private WithEvents m_Events As fsEvents
  48. Attribute m_Events.VB_VarHelpID = -1
  49. Private Sub cmdClient_Click()
  50.     Dim s(2) As Single
  51.     ' ** Position the server in upper left corner
  52.     ' ** of the screen and have the client be
  53.     ' ** positioned at bottom right corner of
  54.     ' ** the server;
  55.     Me.Move 0, 0
  56.     s(1) = Me.Left + Me.Width
  57.     s(2) = Me.Top + Me.Height
  58.     ' ** Let the client know the width and height
  59.     Call m_Share.PutData("pos", s())
  60.     ' ** Lauch the client
  61.     Shell "client.exe", vbNormalFocus
  62.     Label1.Caption = ""
  63.     Label1.Refresh
  64.         
  65. End Sub
  66. Private Sub cmdOK_Click()
  67.     Unload Me
  68. End Sub
  69. Private Sub Form_Initialize()
  70.     Set m_Share = New fsShare
  71.     ' ** We need to get messages back from the cleint
  72.     Set m_Events = m_Share.fsEvents
  73.     ' ** Start this application as a server application
  74.     m_Handle = m_Share.StartServer("my server")
  75. End Sub
  76. Private Sub Form_Load()
  77.     ' ** Make some data available for the client
  78.     Call m_Share.PutData("Company", "Fishhead Software")
  79.     Call m_Share.PutData("Product", "fsShare")
  80.     ' ** You can even pass objects;
  81.     Call m_Share.PutObject("server form", frmServer)
  82.     Label1.Caption = "First press the client button.  This will load the client."
  83. End Sub
  84. Private Sub Form_Terminate()
  85.     ' ** Unload the server, this will disconnect
  86.     ' ** any clients that may be attached.  Also,
  87.     ' ** all the data will be removed;
  88.     m_Share.StopServer
  89. End Sub
  90. Private Sub m_Events_ReceiveMessage(ByVal Handle As Long, ByVal Message As Long, ByVal Data As Variant)
  91.    Select Case Message
  92.    ' ** Eccho the pass in text if its
  93.    ' ** the user's defined message;
  94.    Case (fsSHFMUser + 1)
  95.       Label1.Caption = Data
  96.    End Select
  97. End Sub
  98.